#ifndef __SKIN_TRACKER__
#define __SKIN_TRACKER__

#define INPUT_WIDTH		640
#define INPUT_HEIGHT	480

enum COLOR_TYPE
{
	COLOR_RGB,
	COLOR_YUV,
	COLOR_HSV
};

/* DESCRIPTION:

*/
#include <opencv2/opencv.hpp>
#include <vector>
#include <stdint.h>
using namespace cv;
class SkinTracker
{
public:
	SkinTracker();
	~SkinTracker();

	void initialize();

	void trackColorObject(Mat & imgBGR);
	void trackFramesBGR(Mat & imgBGR, Mat & imgD, Point2i center, ushort depthThresh);
	void trackFramesYUV422(Mat & rawYUV, Mat & imgD, Point2i center, ushort depthThresh);
	void trackFramesYUV422(Mat & rawYUV, Mat & imgD, Point3f handPoint);
	void updateTraining(Mat & imgBGR,Mat & imgMask, double count);

	Rect d_crop_rect;
	Mat  previewMask;
private:
	int m_DataCount;
	cv::Mat m_Psc;

	string folderPath;
	
	void colorPointsMarking(Mat & uChannel, Mat & vChannel, Mat & mask, Mat & output);
	void colorNeighborMarking(Mat & uChannel, Mat & vChannel, Mat & mask, Mat & outputMat);
	void connectedComponentLabeling(Mat & inputMat);
};

bool genDepthMask(Mat & inputMat, ushort depthThresh, Mat & outputMat);
void eroding(Mat & inputMat, Mat & outputMat, int erode_size);
void dilating(Mat & inputMat, Mat & outputMat, int dilation_size);

void compareImage(Mat & colorImg, Mat & maskImg);
void previewColorImage(Mat & mRGB, COLOR_TYPE type);
void previewHistogram(Mat & mRGB, COLOR_TYPE type);
void cannyTest(Mat & grayScaleImg);
#endif